
package br.com.fiap.backbean;

import br.com.fiap.bean.NotaBean;
import java.util.ArrayList;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean(name="nota")
@SessionScoped
public class NotaBackBean {
    private ArrayList<NotaBean> notas;
    private NotaBean nota = new NotaBean();

    public NotaBean getNota() {
        return nota;
    }

    public void setNota(NotaBean nota) {
        this.nota = nota;
    }

    public ArrayList<NotaBean> getNotas() {
        return notas;
    }

    public void setNotas(ArrayList<NotaBean> notas) {
        this.notas = notas;
    }
    public NotaBackBean(){
        notas = new ArrayList<NotaBean>();
        
        NotaBean n1 = new NotaBean();
        n1.setNome("Megan");
        n1.setSobrenome("Fox");
        n1.setNota(10);

        notas.add(n1);

    }

    public String adicionar(){
        notas.add(nota);
        nota = new NotaBean();
        return null;
    }

    
    
    public String aumentarNota(NotaBean selecao){
        
        selecao.setNota(selecao.getNota()+1);

        return null;
    }

    public String deletarNota(NotaBean selecao){
        notas.remove(selecao);
        
        return null;
    }
}
